﻿using System.Windows;
using AzureDiagMon.Common.Helpers;
using AzureDiagMon.Common.Mvvm.Helpers;

namespace AzureDiagMon.Common.Views
{
    /// <summary>
    /// Description for ModalDialog.
    /// </summary>
    public partial class ModalDialog : Window
    {
        /// <summary>
        /// Initializes a new instance of the ModalDialog class.
        /// </summary>
        public ModalDialog()
        {
            InitializeComponent();
            DataContext = ViewModelHelper.GetViewModel(GetType().Name);

            //TODO: Apply size
            //        var dialogViewModel = DataContext as ModalDialogViewModel;
            //        var childViewModel = dialogViewModel.ChildViewModel;

            //        var dialogSize =
            //childViewModel.GetType().GetCustomAttributes(typeof(DialogSizeAttribute), false).FirstOrDefault() as
            //DialogSizeAttribute;
            //        if (dialogSize != null)
            //        {
            //            Width = dialogSize.Width;
            //            Height = dialogSize.Height;
            //        }
        }

        private void OnWindowLoaded(object sender, RoutedEventArgs e)
        {
            WpfHelper.FocusFirstChildInputElement(childControl);
        }
    }
}